package cn.yj.core.business.controller;

import cn.yj.api.FileUploadHandler;
import cn.yj.config.annotation.Anonymous;
import cn.yj.entity.InputStreamEntity;
import cn.yj.entity.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author 永健
 * @since 2021-05-14 18:03
 */
@RequestMapping("/upload")
@RestController
public class FileUploadController {

    @PostMapping("/test")
    @Anonymous
    public R test(MultipartFile file) throws Exception {
        return R.success(FileUploadHandler.getInstant().upload(new InputStreamEntity(file.getInputStream(),"1ssss.jpg")));
    }
}
